home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Programming / MPW Interfaces & Libraries 3.1 / AIncludes / IntEnv.a < prev    next >
Encoding:
Text File  |  1988-11-30  |  4.2 KB  |  109 lines  |  [TEXT/MPS ]

  1. *  File IntEnv.a
  2. *
  3. *  Copyright Apple Computer, Inc. 1986 - 1988
  4. *  All rights reserved.
  5. *
  6. *  Include File for Accessing the Integrated Environment Libraries
  7.  
  8. *  Set CASE OBJECT to assure references to the names IMPORTed here link
  9. *  properly.  The following statements restore the CASE setting to its
  10. *  previous value.
  11.  
  12.             PRINT            Push,Off            ; save current print settings and turn it off
  13.             GBLC            &S%%%,&P%%%
  14. &S%%%        SETC            &Setting('CASE')    ; save current CASE setting
  15. &P%%%        SETC            &Setting('PRINT',1) ; and PRINT settings before we changed them
  16.  
  17.             MACRO
  18.             X%%%
  19.             GBLC            &S%%%,&P%%%         ; link references with previously defined variables
  20.             PRINT            Push,&P%%%            ; restore the previous PRINT settings
  21.             CASE            &S%%%                ; and restore the CASE setting
  22.             PRINT            POP                 ; restore the PRINT settings
  23.             ENDM
  24.  
  25.             PRINT            Pop                 ; restore the PRINT settings
  26.             CASE            OBJECT                ; all imported/exported names case significant
  27.  
  28. *  Integrated Environment Globals
  29.  
  30.             IMPORT            StandAlone            ; a long, 0 if in shell, 1 if standalone
  31.             IMPORT            errno                ; a long, error number; set on unsuccessful I/O calls
  32.             IMPORT            MacOSErr            ; a word;  set along with errno if appropriate
  33.  
  34. *  Integrated Environment Routines
  35.  
  36.             IMPORT            _DataInit            ; called for you by _RTInit
  37.             IMPORT            _RTInit             ; your tool MUST call this routine on startup
  38.             IMPORT            _RTExit             ; Does NOT return
  39.             IMPORT            getenv
  40.             IMPORT            IEGETENV
  41.             IMPORT            atexit
  42.             IMPORT            exit
  43.             IMPORT            _exit
  44.             IMPORT            faccess
  45. *  cmd values for faccess
  46. *  F_OPEN        EQU         (('d'<<8)|00)        ; for internal use only
  47. * 'd' => "directory" ops; available for any program
  48. F_DELETE        EQU         (('d'<<8)|01)        ; deletes filename
  49. F_RENAME        EQU         (('d'<<8)|02)        ; renames file to string pointed to by arg
  50. *  'e' => "editor" ops; available to programs running under MPW
  51. F_GTABINFO        EQU         (('e'<<8)|00)        ; arg is address of long, has tab offset
  52. F_STABINFO        EQU         (('e'<<8)|01)        ; arg is address of long, new tab offset
  53. F_GFONTINFO     EQU         (('e'<<8)|02)        ; arg is address of long, has font info
  54. F_SFONTINFO     EQU         (('e'<<8)|03)        ; arg is address of long, new font info
  55.                                                 ; high order-font number; low-font size
  56. F_GPRINTREC     EQU         (('e'<<8)|04)        ; arg is handle to print record TPrint
  57. F_SPRINTREC     EQU         (('e'<<8)|05)        ; arg sets handle to print record TPrint
  58. F_GSELINFO        EQU            (('e'<<8)|06)        ; arg is address of selection record
  59. F_SSELINFO        EQU            (('e'<<8)|07)        ; arg is address of selection record
  60. F_GWININFO        EQU            (('e'<<8)|08)        ; arg is address of a rect
  61. F_SWININFO        EQU            (('e'<<8)|09)        ; arg is address of a rect
  62.  
  63.             IMPORT            open
  64. *  mode values for open call
  65. O_RDONLY        EQU         0
  66. O_WRONLY        EQU         1
  67. O_RDWR            EQU         2
  68. * auxiliary mode flags for open call  (one of above plus zero or more from this list)
  69. O_APPEND        EQU         (1<<3)            ; when writing, seek to EOF before each write
  70. O_RSRC            EQU         (1<<4)            ; open the resource fork
  71. O_CREAT         EQU         (1<<8)            ; create file if it doesn't exist
  72. O_TRUNC         EQU         (1<<9)            ; truncate file to zero size
  73. * only valid with O_CREAT specified
  74. O_EXCL            EQU         (1<<10)         ; if O_CREAT is set, open will fail if file exists
  75. *  predefined file descriptors for standard input, standard output, and diagnostic output
  76. InputFD         EQU         0
  77. OutputFD        EQU         1
  78. DiagnosticFD    EQU         2
  79.  
  80.             IMPORT            close
  81.             IMPORT            read
  82.             IMPORT            write
  83.             IMPORT            ioctl
  84. *  selector values for ioctl calls
  85. *  FIOLSEEK     EQU         (('f'<<8)|00)    ; internal use only
  86. *  FIODUPFD     EQU         (('f'<<8)|01)    ; internal use only
  87. FIOINTERACTIVE    EQU         (('f'<<8)|02)    ; returns 0 if interactive, -1 if not
  88. FIOBUFSIZE        EQU         (('f'<<8)|03)    ; Arg is address of long, returns the optimal
  89.                                             ; buffer size for this device
  90. FIOFNAME        EQU         (('f'<<8)|04)    ; Arg is address of filename associated with  fd
  91. FIOREFNUM        EQU         (('f'<<8)|05)    ; Arg is address of short, returns fd's refnum
  92. FIOSETEOF        EQU         (('f'<<8)|06)    ; Set file length to long in arg
  93. TIOFLUSH        EQU         (('t'<<8)|00)    ; throw away terminal input
  94.  
  95.             IMPORT            lseek
  96. *  mode values for lseek
  97. fromStart        EQU         0
  98. fromCurPos        EQU         1
  99. fromEnd         EQU         2
  100.  
  101.             IMPORT            fcntl
  102. *  argument to fcntl
  103. F_DUPFD         EQU         0
  104.  
  105.  
  106.             PRINT            Push,Off        ; save and turn off PRINT when macro is invoked
  107.             X%%%                            ; invoke the macro to restore CASE setting
  108.             PRINT            POP             ; restore the PRINT settings
  109.